﻿using System.Threading;

namespace SolutionUsingThreadsInViewModel.Model
{
    class TimeConsumingProcessModel : BusinessModelBase
    {
        public void IncrementCounter()
        {
            while (Counter1 < 5000000)
            {
                Counter1++;
            }
        }

        private int counter1 = 0;
        public int Counter1
        {
            get { return counter1; }
            set
            {
                if (counter1 != value)
                {
                    counter1 = value;
                    OnPropertyChanged("Counter1");
                }
            }
        }

        public void DecrementCounter()
        {
            while (Counter2 > 0)
            {
                Counter2--;
                Thread.Sleep(10);
            }
        }

        private int counter2 = 5000000;
        public int Counter2
        {
            get { return counter2; }
            set
            {
                if (counter2 != value)
                {
                    counter2 = value;
                    OnPropertyChanged("Counter2");
                }
            }
        }


    }
}
